#include "TableInsert.h"
#include <QtGui>

namespace xpm {
TableInsert::TableInsert(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	connect(ui.tableWidget, SIGNAL(cellEntered(int,int)), this, SLOT(cellEntered(int,int)));
	connect(ui.tableWidget, SIGNAL(cellPressed(int,int)), this, SLOT(cellPressed(int,int)));
}

TableInsert::~TableInsert()
{
}

void TableInsert::cellEntered(int row, int column) {
	QTableWidgetSelectionRange range(0, 0, row, column);
	ui.tableWidget->setRangeSelected(range, true);
}

void TableInsert::cellPressed(int row, int column) {
	++row;
	++column;
	ui.spinBox->setValue(row);
	ui.spinBox_2->setValue(column);
	this->accept();
}
int TableInsert::getRows() {
	return ui.spinBox->value();
}
int TableInsert::getColumns() {
	return ui.spinBox_2->value();
}
}


